<div class="row">
	<div class="col-md-12">
		<form id="orgAddForm">
            <input type="hidden" class="form-control" name="id" value="${bean.id}">
            <input type="hidden" class="form-control" name="parentId" value="${bean.parentId}">
			<div class="modal-body">
				<div class="form-group" >
					<label id="nameLabel">名称</label>
					<input type="text" class="form-control" name="name" id="name" placeholder="" value="${bean.name!}">
				</div>
                <div class="form-group">
                    <label>状态</label>
                    <select name="status" class="form-control select2" style="width: 100%;">
                        <option value="1" <#if bean.status == '1'>selected</#if>>启用</option>
                        <option value="0" <#if bean.status == '0'>selected</#if>>停用</option>
                    </select>
                </div>
			</div>
			<div class="modal-footer">
				<div class="pull-right">
					<button type="button" class="btn btn-default btn-sm" data-dismiss="modal"><i class="fa fa-close"></i>关闭</button>
					<button type="button" class="btn btn-primary btn-sm" onclick="orgSave()"><i class="fa fa-save"></i>保存</button>
				</div>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript">
var orgSave = function (){
	$("span").remove(".errorClass");
	$("br").remove(".errorClass");
	var status = 1;
	if($("#name").val()==""){
		$("#nameLabel").prepend('<span class="errorClass" style="color:red">*名称不能为空</span><br class="errorClass"/>');
		status = 0;
	}
	if(status == 0){
		return false;
	}else{
		$.ajax({
			url: '/admin/organization/save',
	        type: 'post',
	        dataType: 'text',
	        data: $("#orgAddForm").serialize(),
	        success: function (data) {
	        	$("#lgModal").modal('hide');
	        	alertMsg("保存成功","success");
                orgReload();
	        }
		});
	}
}
</script>